/*
 *
 *  * Copyright (c) 2016. For Intelligent Group.
 *
 */

package com.intelligent.ispc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * Created by Peter on 2016/8/15.
 */
@SpringBootApplication
public class ServerApplication {

    /**
     * Main.
     *
     * @param args string[]
     * @throws Exception Exception
     */
    public static void main(String[] args) throws Exception {
        SpringApplication.run(ServerApplication.class, args);
    }

    /**
     * Declare the task executor bean.
     *
     * @return TaskExecutor
     */
    @Bean
    public TaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setCorePoolSize(5);
        taskExecutor.setKeepAliveSeconds(300000);
        taskExecutor.setMaxPoolSize(50);
        taskExecutor.setQueueCapacity(200);
        return taskExecutor;
    }
}
